UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dPnVfaiqXKSv9Pn+xfDm9vGNhkAwlMSrW+Vigya6Tk4=' 
WHERE 
  key_id = '311149fc80a54f4e91a18635d91e6cf7a85b0c633f626e4343738eaa79fd1a55' 
  AND (
    token = 'dPnVfaiqXKSv9Pn+xfDm9vGNhkAwlMSrW+Vigya6Tk4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024