UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OcFO9wBwzHwUFsD5Bz8ISNiVJ5uboCl+Y6TS8uvRjXs=' 
WHERE 
  key_id = 'f21274ca2c51561ccb5758b9bf0e2ff32ca349d45a5bd6aa616209c85378caa1' 
  AND (
    token = 'OcFO9wBwzHwUFsD5Bz8ISNiVJ5uboCl+Y6TS8uvRjXs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035