UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LZyqUMNgI4ZaWBKZfP9IQVdddjyjE5RHO+N0b22VSHg=' 
WHERE 
  key_id = '1d5d0168005c300ebf89fdb7fd082ed79c431758dc386372ab95f8b7e9db594e' 
  AND (
    token = 'LZyqUMNgI4ZaWBKZfP9IQVdddjyjE5RHO+N0b22VSHg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037