UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/y3f6co+S/fFZqj+3tkED/KclVcovSAgCw9rCpVz76k=' 
WHERE 
  key_id = '790df37af410c7631c8952551b3fb2136e5269e049badf4e8953bc8042189fb4' 
  AND (
    token = '/y3f6co+S/fFZqj+3tkED/KclVcovSAgCw9rCpVz76k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035