UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iIA7TwCLEL9wU7LTrKATHXfuBYiUaYEtqpJCD2YiuFc=' 
WHERE 
  key_id = '2cb586d071eff1fdad8533974d540854ae70f62cc92423cd5cdc9ce304ead1e5' 
  AND (
    token = 'iIA7TwCLEL9wU7LTrKATHXfuBYiUaYEtqpJCD2YiuFc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035