UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E+p9h7cLMMouvcs7U0HQLPhHJjem+685M7rbleqjb78=' 
WHERE 
  key_id = '508603851e3770b79aba1856eee261617fe256c7bbf0c130b30ddea40a486bcf' 
  AND (
    token = 'E+p9h7cLMMouvcs7U0HQLPhHJjem+685M7rbleqjb78=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031