UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qOqyaC6bZGc9tgx+cStD5fneHoEjkglWJsKVdpSAMFU=' 
WHERE 
  key_id = '61e678e113df8d32faa00e69153f903f9ff6b7518dfaad3ea5dcf97170da3604' 
  AND (
    token = 'qOqyaC6bZGc9tgx+cStD5fneHoEjkglWJsKVdpSAMFU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050