UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yMSsZEuhuFMAQqSfH8Q8EISLbZLWuuSJ+zxvZct/JWo=' 
WHERE 
  key_id = '38f68bbe3e68f37155718662187382f5ece2b1c307fb89716b24747930036f57' 
  AND (
    token = 'yMSsZEuhuFMAQqSfH8Q8EISLbZLWuuSJ+zxvZct/JWo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050