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

Query time 0.00034