UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Wl7YNtt+ISEEHAPW1vEwN3UIJ+5c0UpPO962N/ZsUl8=' 
WHERE 
  key_id = '34a90774baf71f9c86ad9eaff1cf0606776c5e45e01ed1217977333602788987' 
  AND (
    token = 'Wl7YNtt+ISEEHAPW1vEwN3UIJ+5c0UpPO962N/ZsUl8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026