UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P+Caqn9DcwnUt/Fe6TAdfFr85bJ9SJV8ephoaEGVErM=' 
WHERE 
  key_id = '49ffef7aea5fb3ca43e2ce2d6e3800cc3decc562b1a468e605ed525096a9a99f' 
  AND (
    token = 'P+Caqn9DcwnUt/Fe6TAdfFr85bJ9SJV8ephoaEGVErM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031