UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WO1h7diiO492+qdnrIy2XBgTuKtlIttqZiTJF8nEuok=' 
WHERE 
  key_id = '2582d96c3b51d5fec45160c562eb3d0d1f1ec5ede932893f9eb64a7dde5278ba' 
  AND (
    token = 'WO1h7diiO492+qdnrIy2XBgTuKtlIttqZiTJF8nEuok=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020