UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fklyIM+TgzfRkfIIJDR8B/c11ceCTw2sFdtmQQ1P5Zs=' 
WHERE 
  key_id = 'c3d26489cb87ad7a80fc1d2d0dea013688bec06354aa6fac0dfc1f341194fe55' 
  AND (
    token = 'fklyIM+TgzfRkfIIJDR8B/c11ceCTw2sFdtmQQ1P5Zs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025