UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B6qvX5MAkQXLdnZycZB2+C7Xve7EUdPS+qveRb5folc=' 
WHERE 
  key_id = '61d55904506308ea0fe674ec1b0fac4750777a4d1818dc792638be10a3f583e8' 
  AND (
    token = 'B6qvX5MAkQXLdnZycZB2+C7Xve7EUdPS+qveRb5folc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031