UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v3FjklCV7pJE/IYIeNx1rOS1j2M8GWoPmgkoBnT5IxI=' 
WHERE 
  key_id = 'd6c366bddfa697f2090131b4e285fc3ac4472e2b22b652a89cee38ecac065afe' 
  AND (
    token = 'v3FjklCV7pJE/IYIeNx1rOS1j2M8GWoPmgkoBnT5IxI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029