UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h0wV7TUSRAkUZR45fanovYGcf4IQb6BM8oLoKf5cATg=' 
WHERE 
  key_id = '081be04d440785f6090003203d9d4316af4c4a8aec386c5530a30bb4fe688445' 
  AND (
    token = 'h0wV7TUSRAkUZR45fanovYGcf4IQb6BM8oLoKf5cATg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028