UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tnZkV3LUN3LCOTTlmETwZx/8HO2zMBortTtlDMmikfQ=' 
WHERE 
  key_id = '0cc8bd387ef73a5f7174e5661ca1a9a3e05e820ee96e5afcaeaefe7c8120f969' 
  AND (
    token = 'tnZkV3LUN3LCOTTlmETwZx/8HO2zMBortTtlDMmikfQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030