UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Pb2EHObewkCn/hRKvJFs7wXtfW4843KQYs9W2+MDgKY=' 
WHERE 
  key_id = '5bfef7cb0b5c8c6b78a9895b6e336f9e70f98db4bb8806e4901bfa93b5dd657c' 
  AND (
    token = 'Pb2EHObewkCn/hRKvJFs7wXtfW4843KQYs9W2+MDgKY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029