UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tupzfByZ2ZrcqToOy7ANe4OxZEl8ZZ3bK8bj/x/BCdU=' 
WHERE 
  key_id = '4a5cc89d21e4b09539e6f34ac6c404f54adc48c4c082cfec75f1378f52b8f506' 
  AND (
    token = 'tupzfByZ2ZrcqToOy7ANe4OxZEl8ZZ3bK8bj/x/BCdU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042