UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Kh9kbxTpnlFRsw0bUZ47pW00AFWV3bIkMpaMMiPxQ5c=' 
WHERE 
  key_id = 'f064d667bfee9760e434f8e5d9d07c198048610cfb1e019a7a9c6e315f77aa88' 
  AND (
    token = 'Kh9kbxTpnlFRsw0bUZ47pW00AFWV3bIkMpaMMiPxQ5c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022