UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xcpZhIVA3Bi+EO/qrXra+zrLSKw5LqXyQBnXe787zVY=' 
WHERE 
  key_id = '382c3ab038dc2af2f8dd14123e9466d325646c96007f8022998d1136ed458599' 
  AND (
    token = 'xcpZhIVA3Bi+EO/qrXra+zrLSKw5LqXyQBnXe787zVY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025