UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '04iyOihsFtb8H2xudVwrBWgnfkhgYYhk33N6yFEyFAM=' 
WHERE 
  key_id = 'ad1779608725d0a32bd5348ee34e63c739da2e871f1022c7777e64a5e51f33ba' 
  AND (
    token = '04iyOihsFtb8H2xudVwrBWgnfkhgYYhk33N6yFEyFAM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032