UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Rknw3qxNdO2+tC9E3x9RxDc4WxmIPPaLgfEvAZUBjKo=' 
WHERE 
  key_id = '8b3bff461ba478c18644007b4816bc492ac9b396d4ba0121baccd4e377d11695' 
  AND (
    token = 'Rknw3qxNdO2+tC9E3x9RxDc4WxmIPPaLgfEvAZUBjKo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046