UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oYy/CHtxOIO50juuVlsKelQgMXzVQLt4g9gkec/eFl8=' 
WHERE 
  key_id = '6e968b96794662beda5f5515bdd38de865cfb312efba6e3e922c7667bc9e1927' 
  AND (
    token = 'oYy/CHtxOIO50juuVlsKelQgMXzVQLt4g9gkec/eFl8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032