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

Query time 0.00053