UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'u0DiP7wvp4BGBLL2iSkXeeNr/YjjL4/G59CF7ygmXEA=' 
WHERE 
  key_id = 'd66479fcdf168c570aa24c9e43639e736214f839cb481f7ae12a6a4b680e23f7' 
  AND (
    token = 'u0DiP7wvp4BGBLL2iSkXeeNr/YjjL4/G59CF7ygmXEA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046