UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KUCuuX27j6bwciUKJCN8luqPliLgoRfLW8AHPcYtrJE=' 
WHERE 
  key_id = 'cfa5a4a66aa1728618823948ab4c6d1746397eec061c85e05b61ca12c0e5afc6' 
  AND (
    token = 'KUCuuX27j6bwciUKJCN8luqPliLgoRfLW8AHPcYtrJE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027