UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W11v0lf41mNwDfooe1orfJGqHszcp80IWQ5UqtD5p9U=' 
WHERE 
  key_id = 'ae1914ba887df9c76ff871064a44d40954b6bec07904754bf9bd6d13fc24144e' 
  AND (
    token = 'W11v0lf41mNwDfooe1orfJGqHszcp80IWQ5UqtD5p9U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019