UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oetI5O8icxVxFBqKU1IiBP+NdEVikCXYMYxCgk1HJ4U=' 
WHERE 
  key_id = 'b6caaa68640a75d7eca44d8d2953657856941221086d6cfed5ac336312d2d45a' 
  AND (
    token = 'oetI5O8icxVxFBqKU1IiBP+NdEVikCXYMYxCgk1HJ4U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015