UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pttAzfXZXkUFKBdBWN0PwKKnlRafunBuDbhfk6rX9NM=' 
WHERE 
  key_id = '0476fdeb889caf1e6f340b4752ab0980ae14d216b23bf57cc207dc31926b0098' 
  AND (
    token = 'pttAzfXZXkUFKBdBWN0PwKKnlRafunBuDbhfk6rX9NM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028