UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rRhi7RH2+xFSo0BArCAqbn9LwsYdGbmMHLE3Z3RAO/s=' 
WHERE 
  key_id = 'fd181defa118bb80cfd6cc11f9cf923e5a0785550fa3868f6de13bb4eb1fc807' 
  AND (
    token = 'rRhi7RH2+xFSo0BArCAqbn9LwsYdGbmMHLE3Z3RAO/s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039