UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'z/6OdFo+zjV3N43GTIlAUIN0KIbs2uQB0JCgaTPW9Jc=' 
WHERE 
  key_id = 'd82ffddbd046e7dd2362178f8b73a9c188090574ebb94804d23d0a69c3f52f44' 
  AND (
    token = 'z/6OdFo+zjV3N43GTIlAUIN0KIbs2uQB0JCgaTPW9Jc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052