UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AsVnzz+tNLiqchyq0lIQs4IqjxOEimVb72oWv79+0w8=' 
WHERE 
  key_id = '797dade292286f4b402255d7c78191389bde2f76918b6abd14fae276001086cc' 
  AND (
    token = 'AsVnzz+tNLiqchyq0lIQs4IqjxOEimVb72oWv79+0w8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022