UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0zvU3Xx+kYifoR2y93UYterX7VXkzodKFW4uVID6EWw=' 
WHERE 
  key_id = '42d572404369c0e68cba63759ee0eca000d082b049fc58c34a2a9f32adc25d5c' 
  AND (
    token = '0zvU3Xx+kYifoR2y93UYterX7VXkzodKFW4uVID6EWw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028