UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ROgtuH6pvTaoE5DVBcOo4k5jrA2JiKqW6poLxK8ZWSc=' 
WHERE 
  key_id = '46519a1d97e7ae805c0274779bd43916b21f7bb0c20f0cd1b26330ba8f1d3723' 
  AND (
    token = 'ROgtuH6pvTaoE5DVBcOo4k5jrA2JiKqW6poLxK8ZWSc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037