UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bTMWYvU2gcSq03llNNEbqA6od5OAXrZbAXcR/ftrVCs=' 
WHERE 
  key_id = '991886e0c8bb981df0dc48c6f9ad8c0858319918c7f12254c74eee462f70f95c' 
  AND (
    token = 'bTMWYvU2gcSq03llNNEbqA6od5OAXrZbAXcR/ftrVCs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042