UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gmVtOHMw3WCDqEp65nlouTEliIQMiFMiQ3i5j9qq7Zg=' 
WHERE 
  key_id = '6e972857cb63080541cb8255a232a3a1f1291b78a55dc3f7f82aba9e8e2b8cd5' 
  AND (
    token = 'gmVtOHMw3WCDqEp65nlouTEliIQMiFMiQ3i5j9qq7Zg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032