UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SLBPPi1ey0bgDsh5kV+84qibLsJt3VP4hw3IjIZ2fI8=' 
WHERE 
  key_id = '00953572e17cfa646071267efc98188d7e4df49d392267761a3dbf29412f112e' 
  AND (
    token = 'SLBPPi1ey0bgDsh5kV+84qibLsJt3VP4hw3IjIZ2fI8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029