UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YnjhItZkONhBgALn6kPkk2X2gFdX9aL/PAl3halDX/k=' 
WHERE 
  key_id = 'c1dd5691a2c4e74198c43ec84fe1e18b1d87b826330c38fe924d2d6989c6e506' 
  AND (
    token = 'YnjhItZkONhBgALn6kPkk2X2gFdX9aL/PAl3halDX/k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043