UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CQvXvaaU+9gh4b1h3lq4TxZnFeHky4C8YqiOEEBeDmM=' 
WHERE 
  key_id = 'ce69f542159968f4b602d8fe5c57533b24580c51c1dde4a26d7b192dd3b7587b' 
  AND (
    token = 'CQvXvaaU+9gh4b1h3lq4TxZnFeHky4C8YqiOEEBeDmM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032