UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zQEktkyNCKvamI9qrBbofm2qQmdPcNhqghe+024DZFc=' 
WHERE 
  key_id = '3982ebb643025ffdcd3cefdc72b2bd0106ba5f0a61412f908219b38a59e34992' 
  AND (
    token = 'zQEktkyNCKvamI9qrBbofm2qQmdPcNhqghe+024DZFc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030