UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vCQg17VaW/4ovxL54Sfz6Sgfaj3WB27Rdtvmbe5LiYw=' 
WHERE 
  key_id = 'b1abe93864e7184e201157fe1290b10bc78c5b139358deb3225cdd7881d8a416' 
  AND (
    token = 'vCQg17VaW/4ovxL54Sfz6Sgfaj3WB27Rdtvmbe5LiYw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016