UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd8RNuySZcj572c1Zum3j7zXyN9Leby/sDDK7u+n5lyg=' 
WHERE 
  key_id = '49011c8aeee7bf80310c6f1c025343159c4dd54b9b538de0edd2c06c22ae6608' 
  AND (
    token = 'd8RNuySZcj572c1Zum3j7zXyN9Leby/sDDK7u+n5lyg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023