UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dszn9sBY+GNQqRTDGxLMrQGEaDmG1kWIzevX/4elWRA=' 
WHERE 
  key_id = 'bf53d80da37aa12dc03381d83adc1b714d416956279b796b984051b95c74e0e3' 
  AND (
    token = 'dszn9sBY+GNQqRTDGxLMrQGEaDmG1kWIzevX/4elWRA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052